/**
 * Created by zander on 2018/1/22.
 */
function clearMMS() {
    $("#clearCode").attr("class", "col-md-2 show");
    $("#Result").attr("class", "col-md-2 show");
}

function getProject() {
    var a = document.getElementById("Project");
    var b = a.options[a.selectedIndex].value;
    return b;
}

function clearCodeSMS() {
    var patrn1 = /^[0-9]*[1-9][0-9]*$/;
    var phone = document.getElementById('inputPhone').value;
    var project = getProject();
    if (phone == "") {
        alert("手机号不能为空");
        return false;
    } else if (!patrn1.test(phone)) {
        alert("手机号只能输入数字");
        return false;
    }
    document.getElementById('res').innerText = '';
    $.ajax({
        type: "POST",
        url: "/v1/clearCode",
        data: {
            project: project,
            phone: phone,
        },
        traditional: true,
        dataType: "json",
        beforeSend: function () {
            $("body").mLoading("show");
        },
        success: function (ret) {
            if (ret.status == "0000") {
                $("body").mLoading("hide");
                $("#res").append(ret.message);
            } else {
                $("body").mLoading("hide");
                $("#res").append(ret.message);
            }
        },
        error: function () {
            $("body").mLoading("hide");
            $("#res").append("Error 500,请联系开发人员！");
        }
    });
}